// display the 2-D Fourier transformed densities
// the data format is in 'q rho(q)'
// by Asia Sun, Jul. 8, 2022

static int co = 0; // graph color
void primp(TGraph *g); // primp the graph

void rhoq(){
  TLegend *lg = new TLegend(0.3, 0.5, 0.89, 0.89); lg->SetBorderSize(0);
  TGraph *gc = new TGraph("c.txt", "%lg %lg"); primp(gc); lg->AddEntry(gc, "\\rho_{c}(q)");
  TGraph *gv = new TGraph("v.txt", "%lg %lg"); primp(gv); lg->AddEntry(gv, "\\rho_{v}(q)");
  TGraph *gt = new TGraph("t.txt", "%lg %lg"); primp(gt); lg->AddEntry(gt, "\\rho_{t}(q)");
  TGraph *gct = new TGraph("ct.txt", "%lg %lg"); primp(gct);
  // a is the proton gaussian size parameter: exp(-a^2)
  lg->AddEntry(gct, "q\\rho_{c}(q)\\rho_{t}(q)e^{-\\beta_{NN}q^{2}}");
  TGraph *gvt = new TGraph("vt.txt", "%lg %lg"); primp(gvt);
  lg->AddEntry(gvt, "q\\rho_{v}(q)\\rho_{t}(q)e^{-\\beta_{NN}q^{2}}");

  TCanvas *c = new TCanvas("c", "c", 800, 600);
  gct->Draw();
  gv->Draw("same");
  gc->Draw("same");
  gt->Draw("same");
  gvt->Draw("same");
  lg->Draw();

  c->Print("rho.pdf");
} // end main function mom

// primp the graph
void primp(TGraph *g){
  TAxis *ax = g->GetXaxis(); ax->SetTitle("q [fm^{-1}]"); ax->CenterTitle();
  TAxis *ay = g->GetYaxis(); ay->SetTitle("\\rho(q)"); ay->CenterTitle();
  co++;
  if(5 == co || 10 == co) co++;
  g->SetLineColor(co); g->SetMarkerColor(co);
} // end function primp
